﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NetworkingProjectJoined
{
    public partial class ShowQuestion : Form
    {
        int time;
        public ShowQuestion()
        {
            InitializeComponent();
            time = 10;
            m_lblTimer.Text = time.ToString("00");
            secondTimer.Start();
        }

        //call the other constructor using this()
        public ShowQuestion(string question, string answer):this()
        {
            m_lblAnswer.Text = answer;
            m_lblQuestion.Text = question;

        }

        private void secondTimer_Tick(object sender, EventArgs e)
        {
            time--;
            m_lblTimer.Text = time.ToString("00");
            if (time == 0)
            {
                secondTimer.Stop();
                m_lblAnswer.Visible = true;
                showAnswerTimer.Start();
            }
        }

        private void showAnswerTimer_Tick(object sender, EventArgs e)
        {
            Close();
        }
    }
}
